Skip to content

[PM-32421] CLI: prevent false-success SSO login when account cannot decrypt (#18992) - #19044

Closed
HadiAyache wants to merge 1 commit into
bitwarden:mainfrom
HadiAyache:fix/cli-sso-false-success-18992
Closed

[PM-32421] CLI: prevent false-success SSO login when account cannot decrypt (#18992)#19044
HadiAyache wants to merge 1 commit into
bitwarden:mainfrom
HadiAyache:fix/cli-sso-false-success-18992

Conversation

@HadiAyache

@HadiAyache HadiAyache commented Feb 17, 2026

Copy link
Copy Markdown

Summary

Fixes a CLI SSO edge case where login reports "You are logged in!" even though the account cannot decrypt/unlock in CLI.

This updates SSO validation to fail early only when all are true:

  • user has no master password
  • no key connector path is configured
  • no user key is available in memory

This avoids over-blocking valid no-master-password flows (for example, key connector setup).

Changes

  • apps/cli/src/auth/commands/login.command.ts
    • refine validateSsoUserInMpEncryptionOrgHasMp gating logic
    • return clearer error message for non-decryptable SSO CLI state
  • apps/cli/src/auth/commands/login.command.spec.ts (new)

Tests

Ran locally:

  • npx jest apps/cli/src/auth/commands/login.command.spec.ts --runInBand
  • npx jest libs/auth/src/common/login-strategies/sso-login.strategy.spec.ts --runInBand
  • npx jest apps/cli/src/key-management/commands/unlock.command.spec.ts --runInBand

All passed.

Closes #18992

@HadiAyache
HadiAyache requested a review from a team as a code owner February 17, 2026 23:14
@HadiAyache
HadiAyache requested a review from rr-bw February 17, 2026 23:14
@CLAassistant

CLAassistant commented Feb 17, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@bitwarden-bot

Copy link
Copy Markdown
Collaborator

Thank you for your contribution! We've added this to our internal tracking system for review.
ID: PM-32421
Link: https://bitwarden.atlassian.net/browse/PM-32421

Details on our contribution process can be found here: https://contributing.bitwarden.com/contributing/pull-requests/community-pr-process.

@bitwarden-bot bitwarden-bot changed the title CLI: prevent false-success SSO login when account cannot decrypt (#18992) [PM-32421] CLI: prevent false-success SSO login when account cannot decrypt (#18992) Feb 17, 2026
@bitwarden-bot bitwarden-bot added community-pr needs-qa Marks a PR as requiring QA approval labels Feb 17, 2026
@HadiAyache
HadiAyache force-pushed the fix/cli-sso-false-success-18992 branch 2 times, most recently from c18f569 to 518c775 Compare February 24, 2026 22:37
@HadiAyache
HadiAyache force-pushed the fix/cli-sso-false-success-18992 branch from 518c775 to b1b2972 Compare February 25, 2026 00:30
@HadiAyache

Copy link
Copy Markdown
Author

Quick status: current failing checks appear to be permission-gated workflow checks (author permission level) rather than deterministic code/test failures in this branch. If maintainers can rerun/approve the gated workflow path, I can immediately address any concrete code failures that remain.

@JaredSnider-Bitwarden

Copy link
Copy Markdown
Contributor

@HadiAyache thank you for your submission. We've chosen to solve this with product approved copy internally and simply based on known supported user decryption options with #22411.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

community-pr needs-qa Marks a PR as requiring QA approval

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CLI SSO login succeeds while actually failing

4 participants